extends Sprite2D

var yh = preload("res://ston/fireworks.tscn")

@export var SD = 500

var _fx = Vector2.RIGHT
var _mbName = "敌人"
func _ready() -> void:
	print("目标是",_mbName)	
	print("当前分数",Global.playFS)


func fire(fx : Vector2):
	_fx = fx

func _process(delta: float) -> void:
	position += delta * SD * _fx


func _on_area_2d_area_entered(area: Area2D) -> void:
	print("子弹希望打中",_mbName,"当前的",area.get_groups())
	if area.is_in_group(_mbName):
		print("打中了")
		Global.playFS += 1
		var _yh = yh.instantiate()
		_yh.position = position
		get_tree().root.add_child(_yh)
		queue_free()
